home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
String
/
src
/
reverse.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
426b
|
33 lines
#include "String.h"
RJS_String &RJS_String::reverse()
{
int n=length()/2;
char temp;
int loc,i;
for (i=0; i< n; i++) {
loc=length()-i-1;
temp=sd.data[i];
sd.data[i]=sd.data[loc];
sd.data[loc]=temp;
}
update();
return *this;
}
RJS_String reverse(const char *s)
{
RJS_String st(s);
st.reverse();
return st;
}
RJS_String reverse(const RJS_String &s)
{
RJS_String st(s);
st.reverse();
return st;
}